package com.example.cachedesign.business.controller;

import com.example.cachedesign.business.domain.Student;
import com.example.cachedesign.business.service.StudentService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/students")
public class StudentController {
    private final StudentService studentService;

    public StudentController(StudentService studentService) {
        this.studentService = studentService;
    }

    @GetMapping("/{id}")
    public Student getStudent(@PathVariable Long id) {
        return studentService.getStudent(id);
    }

    @PutMapping
    public Boolean updateStudent(@RequestBody Student student) {
        return studentService.update(student);
    }
}
